<template>
	<view class="">
		<view class="form">
			<view class="textarea">
				<textarea v-model="signature" placeholder="请输入个人签名"></textarea>
			</view>
			
		</view>
		
		
		<view class="btns">
			<button @click="onSubmit">确定签名内容</button>
		</view>
	</view>
</template>

<script>
	import {
		getUserInfo,
		editSignature
	} from '@/api/user.js';
	export default {
		data() {
			return {
				userInfo: {},
				signature: ''
			}
		},
		onShow() {
			this.getUserInfo();	
		},
		methods: {
			getUserInfo() {
				getUserInfo().then(res => {
					this.signature = res.data.signature;
				})
			},
			onSubmit() {
				editSignature({
					signature: this.signature
				}).then(res => {
					this.getUserInfo();	
					
					this.$util.Tips({
						title: res.msg,
						icon: 'success'
					})
				}).catch(err => {
					return this.$util.Tips({
						title: err
					});
				})
				
			}
		}
	}
</script>

<style>
	page {
		background-color: #003153;
	}
</style>
<style scoped lang="scss">
	.form {
		margin: 65rpx 30rpx;
	}
	.textarea {
		width: 690rpx;
		height: 217rpx;
		background: #FFFFFF;
		border-radius: 15rpx 15rpx 15rpx 15rpx;
		padding: 23rpx;
		textarea {
			width: 100%;
			height: 100%;
		}
	}
	
	.btns {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		padding: 65rpx 35rpx;
		button {
			width: 680rpx;
			height: 80rpx;
			background: #0B9AFF;
			border-radius: 15rpx 15rpx 15rpx 15rpx;
			font-weight: 500;
			font-size: 35rpx;
			color: #FFFFFF;
			text-align: center;
			line-height: 80rpx;
		}
	}
</style>